package com.wo.cloud.tenant.controller;

import com.wo.cloud.tenant.entity.Teacher;
import com.wo.cloud.tenant.mapper.TeacherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/4/12 10:51
 * Description:
 */

@RestController
@RequestMapping("/tenant")
public class TenantController {

    @Autowired
    private TeacherMapper mapper;

    @GetMapping
    public Object list(){
        return mapper.selectList(null);
    }

    @PostMapping("/save")
    public Object save(){
        Teacher teacher = new Teacher();
        teacher.setAddrName("tim").setAge(10).setUsername("哈哈哈");
        mapper.insert(teacher);
        return "新增成功";
    }
}
